package com.keyinong.parkin.home.adapter;

import java.util.ArrayList;

import com.example.parkin.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class PpAreaAdapter extends BaseAdapter {
	String[] area;
	Context context;

	public PpAreaAdapter(String[] area, Context context) {
		super();
		this.area = area;
		this.context = context;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return area.length;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return area[position];
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View view, ViewGroup parent) {
		ViewHandle handle;
		if (view == null) {
			handle = new ViewHandle();
			view = LayoutInflater.from(context).inflate(
					R.layout.item_ppgrid_area, null);
			handle.tv_area=(TextView) view.findViewById(R.id.tv_area);
            view.setTag(handle);
		}else{
			handle=(ViewHandle) view.getTag();
		}
		handle.tv_area.setText(area[position]);
		return view;
	}

	private class ViewHandle {
		TextView tv_area;

	}

}
